.class public Lorg/microemu/android/device/AndroidDeviceDisplay;
.super Ljava/lang/Object;
.source "AndroidDeviceDisplay.java"

# interfaces
.implements Lorg/microemu/device/DeviceDisplay;


# instance fields
.field private context:Lorg/microemu/EmulatorContext;

.field public displayRectangleHeight:I

.field public displayRectangleWidth:I


# direct methods
.method public constructor <init>(Lorg/microemu/EmulatorContext;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 59
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 60
    iput-object p1, p0, Lorg/microemu/android/device/AndroidDeviceDisplay;->context:Lorg/microemu/EmulatorContext;

    .line 61
    return-void
.end method


# virtual methods
.method public createImage(II)Ljavax/microedition/lcdui/Image;
    .locals 1
    .parameter "width"
    .parameter "height"

    .prologue
    .line 80
    if-lez p1, :cond_0

    if-gtz p2, :cond_1

    .line 81
    :cond_0
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v0

    .line 84
    :cond_1
    new-instance v0, Lorg/microemu/android/device/AndroidMutableImage;

    invoke-direct {v0, p1, p2}, Lorg/microemu/android/device/AndroidMutableImage;-><init>(II)V

    return-object v0
.end method

.method public createImage(Ljava/io/InputStream;)Ljavax/microedition/lcdui/Image;
    .locals 2
    .parameter "is"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 76
    new-instance v0, Lorg/microemu/android/device/AndroidImmutableImage;

    invoke-static {p1}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;)Landroid/graphics/Bitmap;

    move-result-object v1

    invoke-direct {v0, v1}, Lorg/microemu/android/device/AndroidImmutableImage;-><init>(Landroid/graphics/Bitmap;)V

    return-object v0
.end method

.method public createImage(Ljava/lang/String;)Ljavax/microedition/lcdui/Image;
    .locals 1
    .parameter "name"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 64
    iget-object v0, p0, Lorg/microemu/android/device/AndroidDeviceDisplay;->context:Lorg/microemu/EmulatorContext;

    invoke-interface {v0, p1}, Lorg/microemu/EmulatorContext;->getResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v0

    invoke-virtual {p0, v0}, Lorg/microemu/android/device/AndroidDeviceDisplay;->createImage(Ljava/io/InputStream;)Ljavax/microedition/lcdui/Image;

    move-result-object v0

    return-object v0
.end method

.method public createImage(Ljavax/microedition/lcdui/Image;)Ljavax/microedition/lcdui/Image;
    .locals 1
    .parameter "source"

    .prologue
    .line 68
    invoke-virtual {p1}, Ljavax/microedition/lcdui/Image;->isMutable()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 69
    new-instance v0, Lorg/microemu/android/device/AndroidImmutableImage;

    check-cast p1, Lorg/microemu/android/device/AndroidMutableImage;

    .end local p1
    invoke-direct {v0, p1}, Lorg/microemu/android/device/AndroidImmutableImage;-><init>(Lorg/microemu/android/device/AndroidMutableImage;)V

    .line 71
    :goto_0
    return-object v0

    .restart local p1
    :cond_0
    move-object v0, p1

    goto :goto_0
.end method

.method public createImage(Ljavax/microedition/lcdui/Image;IIIII)Ljavax/microedition/lcdui/Image;
    .locals 21
    .parameter "image"
    .parameter "x"
    .parameter "y"
    .parameter "width"
    .parameter "height"
    .parameter "transform"

    .prologue
    .line 93
    if-nez p1, :cond_0

    .line 94
    new-instance v5, Ljava/lang/NullPointerException;

    invoke-direct {v5}, Ljava/lang/NullPointerException;-><init>()V

    throw v5

    .line 95
    :cond_0
    add-int v5, p2, p4

    invoke-virtual/range {p1 .. p1}, Ljavax/microedition/lcdui/Image;->getWidth()I

    move-result v6

    if-gt v5, v6, :cond_1

    add-int v5, p3, p5

    invoke-virtual/range {p1 .. p1}, Ljavax/microedition/lcdui/Image;->getHeight()I

    move-result v6

    if-gt v5, v6, :cond_1

    if-lez p4, :cond_1

    if-lez p5, :cond_1

    if-ltz p2, :cond_1

    if-gez p3, :cond_2

    .line 97
    :cond_1
    new-instance v5, Ljava/lang/IllegalArgumentException;

    const-string v6, "Area out of Image"

    invoke-direct {v5, v6}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v5

    .line 99
    :cond_2
    mul-int v5, p5, p4

    new-array v6, v5, [I

    .line 100
    .local v6, rgbData:[I
    mul-int v5, p5, p4

    move v0, v5

    new-array v0, v0, [I

    move-object/from16 v17, v0

    .line 101
    .local v17, rgbTransformedData:[I
    move-object/from16 v0, p1

    instance-of v0, v0, Lorg/microemu/android/device/AndroidImmutableImage;

    move v5, v0

    if-eqz v5, :cond_3

    .line 102
    move-object/from16 v0, p1

    check-cast v0, Lorg/microemu/android/device/AndroidImmutableImage;

    move-object v5, v0

    const/4 v7, 0x0

    move/from16 v8, p4

    move/from16 v9, p2

    move/from16 v10, p3

    move/from16 v11, p4

    move/from16 v12, p5

    invoke-virtual/range {v5 .. v12}, Lorg/microemu/android/device/AndroidImmutableImage;->getRGB([IIIIIII)V

    .line 109
    :goto_0
    packed-switch p6, :pswitch_data_0

    .line 171
    new-instance v5, Ljava/lang/IllegalArgumentException;

    const-string v6, "Bad transform"

    .end local v6           #rgbData:[I
    invoke-direct {v5, v6}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v5

    .line 104
    .restart local v6       #rgbData:[I
    :cond_3
    move-object/from16 v0, p1

    check-cast v0, Lorg/microemu/android/device/AndroidMutableImage;

    move-object v5, v0

    const/4 v7, 0x0

    move/from16 v8, p4

    move/from16 v9, p2

    move/from16 v10, p3

    move/from16 v11, p4

    move/from16 v12, p5

    invoke-virtual/range {v5 .. v12}, Lorg/microemu/android/device/AndroidMutableImage;->getRGB([IIIIIII)V

    goto :goto_0

    .line 111
    :pswitch_0
    const/16 v16, 0x0

    .line 112
    .local v16, offset:I
    const/4 v14, 0x1

    .line 113
    .local v14, colIncr:I
    const/16 v19, 0x0

    .line 175
    .local v19, rowIncr:I
    :goto_1
    const/16 v18, 0x0

    .local v18, row:I
    const/4 v15, 0x0

    .local v15, i:I
    :goto_2
    move/from16 v0, v18

    move/from16 v1, p5

    if-ge v0, v1, :cond_5

    .line 176
    const/4 v13, 0x0

    .local v13, col:I
    :goto_3
    move v0, v13

    move/from16 v1, p4

    if-ge v0, v1, :cond_4

    .line 183
    aget v5, v6, v16

    aput v5, v17, v15

    .line 176
    add-int/lit8 v13, v13, 0x1

    add-int v16, v16, v14

    add-int/lit8 v15, v15, 0x1

    goto :goto_3

    .line 117
    .end local v16           #offset:I
    .end local v14           #colIncr:I
    .end local v19           #rowIncr:I
    .end local v18           #row:I
    .end local v15           #i:I
    .end local v13           #col:I
    :pswitch_1
    const/4 v5, 0x1

    sub-int v5, p5, v5

    mul-int v16, v5, p4

    .line 118
    .restart local v16       #offset:I
    move/from16 v0, p4

    neg-int v0, v0

    move v14, v0

    .line 119
    .restart local v14       #colIncr:I
    mul-int v5, p5, p4

    add-int/lit8 v19, v5, 0x1

    .line 120
    .restart local v19       #rowIncr:I
    move/from16 v20, p4

    .line 121
    .local v20, temp:I
    move/from16 p4, p5

    .line 122
    move/from16 p5, v20

    .line 123
    goto :goto_1

    .line 126
    .end local v16           #offset:I
    .end local v14           #colIncr:I
    .end local v19           #rowIncr:I
    .end local v20           #temp:I
    :pswitch_2
    mul-int v5, p5, p4

    const/4 v7, 0x1

    sub-int v16, v5, v7

    .line 127
    .restart local v16       #offset:I
    const/4 v14, -0x1

    .line 128
    .restart local v14       #colIncr:I
    const/16 v19, 0x0

    .line 129
    .restart local v19       #rowIncr:I
    goto :goto_1

    .line 132
    .end local v16           #offset:I
    .end local v14           #colIncr:I
    .end local v19           #rowIncr:I
    :pswitch_3
    const/4 v5, 0x1

    sub-int v16, p4, v5

    .line 133
    .restart local v16       #offset:I
    move/from16 v14, p4

    .line 134
    .restart local v14       #colIncr:I
    mul-int v5, p5, p4

    neg-int v5, v5

    const/4 v7, 0x1

    sub-int v19, v5, v7

    .line 135
    .restart local v19       #rowIncr:I
    move/from16 v20, p4

    .line 136
    .restart local v20       #temp:I
    move/from16 p4, p5

    .line 137
    move/from16 p5, v20

    .line 138
    goto :goto_1

    .line 141
    .end local v16           #offset:I
    .end local v14           #colIncr:I
    .end local v19           #rowIncr:I
    .end local v20           #temp:I
    :pswitch_4
    const/4 v5, 0x1

    sub-int v16, p4, v5

    .line 142
    .restart local v16       #offset:I
    const/4 v14, -0x1

    .line 143
    .restart local v14       #colIncr:I
    shl-int/lit8 v19, p4, 0x1

    .line 144
    .restart local v19       #rowIncr:I
    goto :goto_1

    .line 147
    .end local v16           #offset:I
    .end local v14           #colIncr:I
    .end local v19           #rowIncr:I
    :pswitch_5
    mul-int v5, p5, p4

    const/4 v7, 0x1

    sub-int v16, v5, v7

    .line 148
    .restart local v16       #offset:I
    move/from16 v0, p4

    neg-int v0, v0

    move v14, v0

    .line 149
    .restart local v14       #colIncr:I
    mul-int v5, p5, p4

    const/4 v7, 0x1

    sub-int v19, v5, v7

    .line 150
    .restart local v19       #rowIncr:I
    move/from16 v20, p4

    .line 151
    .restart local v20       #temp:I
    move/from16 p4, p5

    .line 152
    move/from16 p5, v20

    .line 153
    goto :goto_1

    .line 156
    .end local v16           #offset:I
    .end local v14           #colIncr:I
    .end local v19           #rowIncr:I
    .end local v20           #temp:I
    :pswitch_6
    const/4 v5, 0x1

    sub-int v5, p5, v5

    mul-int v16, v5, p4

    .line 157
    .restart local v16       #offset:I
    const/4 v14, 0x1

    .line 158
    .restart local v14       #colIncr:I
    shl-int/lit8 v5, p4, 0x1

    move v0, v5

    neg-int v0, v0

    move/from16 v19, v0

    .line 159
    .restart local v19       #rowIncr:I
    goto :goto_1

    .line 162
    .end local v16           #offset:I
    .end local v14           #colIncr:I
    .end local v19           #rowIncr:I
    :pswitch_7
    const/16 v16, 0x0

    .line 163
    .restart local v16       #offset:I
    move/from16 v14, p4

    .line 164
    .restart local v14       #colIncr:I
    mul-int v5, p5, p4

    neg-int v5, v5

    add-int/lit8 v19, v5, 0x1

    .line 165
    .restart local v19       #rowIncr:I
    move/from16 v20, p4

    .line 166
    .restart local v20       #temp:I
    move/from16 p4, p5

    .line 167
    move/from16 p5, v20

    .line 168
    goto/16 :goto_1

    .line 175
    .end local v20           #temp:I
    .restart local v13       #col:I
    .restart local v15       #i:I
    .restart local v18       #row:I
    :cond_4
    add-int/lit8 v18, v18, 0x1

    add-int v16, v16, v19

    goto/16 :goto_2

    .line 187
    .end local v13           #col:I
    :cond_5
    const/4 v6, 0x0

    .line 188
    const/16 p1, 0x0

    .line 190
    const/4 v5, 0x1

    move-object/from16 v0, p0

    move-object/from16 v1, v17

    move/from16 v2, p4

    move/from16 v3, p5

    move v4, v5

    invoke-virtual {v0, v1, v2, v3, v4}, Lorg/microemu/android/device/AndroidDeviceDisplay;->createRGBImage([IIIZ)Ljavax/microedition/lcdui/Image;

    move-result-object v5

    return-object v5

    .line 109
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_6
        :pswitch_4
        :pswitch_2
        :pswitch_7
        :pswitch_1
        :pswitch_3
        :pswitch_5
    .end packed-switch
.end method

.method public createImage([BII)Ljavax/microedition/lcdui/Image;
    .locals 2
    .parameter "imageData"
    .parameter "imageOffset"
    .parameter "imageLength"

    .prologue
    .line 88
    new-instance v0, Lorg/microemu/android/device/AndroidImmutableImage;

    invoke-static {p1, p2, p3}, Landroid/graphics/BitmapFactory;->decodeByteArray([BII)Landroid/graphics/Bitmap;

    move-result-object v1

    invoke-direct {v0, v1}, Lorg/microemu/android/device/AndroidImmutableImage;-><init>(Landroid/graphics/Bitmap;)V

    return-object v0
.end method

.method public createRGBImage([IIIZ)Ljavax/microedition/lcdui/Image;
    .locals 4
    .parameter "rgb"
    .parameter "width"
    .parameter "height"
    .parameter "processAlpha"

    .prologue
    .line 194
    if-nez p1, :cond_0

    .line 195
    new-instance v2, Ljava/lang/NullPointerException;

    invoke-direct {v2}, Ljava/lang/NullPointerException;-><init>()V

    throw v2

    .line 196
    :cond_0
    if-lez p2, :cond_1

    if-gtz p3, :cond_2

    .line 197
    :cond_1
    new-instance v2, Ljava/lang/IllegalArgumentException;

    invoke-direct {v2}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v2

    .line 200
    :cond_2
    move-object v1, p1

    .line 201
    .local v1, newrgb:[I
    if-nez p4, :cond_3

    .line 202
    array-length v2, p1

    new-array v1, v2, [I

    .line 203
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    array-length v2, p1

    if-ge v0, v2, :cond_3

    .line 204
    const v2, 0xffffff

    aget v3, p1, v0

    and-int/2addr v2, v3

    const/high16 v3, -0x100

    or-int/2addr v2, v3

    aput v2, v1, v0

    .line 203
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 207
    .end local v0           #i:I
    :cond_3
    new-instance v2, Lorg/microemu/android/device/AndroidImmutableImage;

    sget-object v3, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

    invoke-static {v1, p2, p3, v3}, Landroid/graphics/Bitmap;->createBitmap([IIILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object v3

    invoke-direct {v2, v3}, Lorg/microemu/android/device/AndroidImmutableImage;-><init>(Landroid/graphics/Bitmap;)V

    return-object v2
.end method

.method public getDisplayImage()Lorg/microemu/device/MutableImage;
    .locals 1

    .prologue
    .line 212
    const/4 v0, 0x0

    return-object v0
.end method

.method public getFullHeight()I
    .locals 1

    .prologue
    .line 216
    iget v0, p0, Lorg/microemu/android/device/AndroidDeviceDisplay;->displayRectangleHeight:I

    return v0
.end method

.method public getFullWidth()I
    .locals 1

    .prologue
    .line 220
    iget v0, p0, Lorg/microemu/android/device/AndroidDeviceDisplay;->displayRectangleWidth:I

    return v0
.end method

.method public getHeight()I
    .locals 1

    .prologue
    .line 225
    iget v0, p0, Lorg/microemu/android/device/AndroidDeviceDisplay;->displayRectangleHeight:I

    return v0
.end method

.method public getWidth()I
    .locals 1

    .prologue
    .line 230
    iget v0, p0, Lorg/microemu/android/device/AndroidDeviceDisplay;->displayRectangleWidth:I

    return v0
.end method

.method public isColor()Z
    .locals 1

    .prologue
    .line 234
    const/4 v0, 0x1

    return v0
.end method

.method public isFullScreenMode()Z
    .locals 1

    .prologue
    .line 239
    const/4 v0, 0x0

    return v0
.end method

.method public numAlphaLevels()I
    .locals 1

    .prologue
    .line 243
    const/16 v0, 0x100

    return v0
.end method

.method public numColors()I
    .locals 1

    .prologue
    .line 247
    const/high16 v0, 0x1

    return v0
.end method

.method public paintDisplayable(IIII)V
    .locals 6
    .parameter "x"
    .parameter "y"
    .parameter "width"
    .parameter "height"

    .prologue
    .line 265
    invoke-static {}, Lorg/microemu/MIDletBridge;->getMIDletAccess()Lorg/microemu/MIDletAccess;

    move-result-object v2

    .line 266
    .local v2, ma:Lorg/microemu/MIDletAccess;
    if-nez v2, :cond_1

    .line 303
    :cond_0
    :goto_0
    return-void

    .line 269
    :cond_1
    invoke-virtual {v2}, Lorg/microemu/MIDletAccess;->getDisplayAccess()Lorg/microemu/DisplayAccess;

    move-result-object v1

    .line 270
    .local v1, da:Lorg/microemu/DisplayAccess;
    if-eqz v1, :cond_0

    .line 273
    invoke-interface {v1}, Lorg/microemu/DisplayAccess;->getCurrentUI()Lorg/microemu/device/ui/DisplayableUI;

    move-result-object v0

    .line 274
    .local v0, current:Lorg/microemu/device/ui/DisplayableUI;
    if-eqz v0, :cond_0

    .line 287
    instance-of v4, v0, Lorg/microemu/device/ui/CanvasUI;

    if-eqz v4, :cond_0

    .line 288
    check-cast v0, Lorg/microemu/android/device/ui/AndroidCanvasUI;

    .end local v0           #current:Lorg/microemu/device/ui/DisplayableUI;
    invoke-virtual {v0}, Lorg/microemu/android/device/ui/AndroidCanvasUI;->getView()Lorg/microemu/android/device/ui/AndroidCanvasUI$CanvasView;

    move-result-object v3

    .line 289
    .local v3, view:Landroid/view/View;
    add-int v4, p1, p3

    add-int v5, p2, p4

    invoke-virtual {v3, p1, p2, v4, v5}, Landroid/view/View;->invalidate(IIII)V

    goto :goto_0
.end method

.method public repaint(IIII)V
    .locals 0
    .parameter "x"
    .parameter "y"
    .parameter "width"
    .parameter "height"

    .prologue
    .line 251
    invoke-virtual {p0, p1, p2, p3, p4}, Lorg/microemu/android/device/AndroidDeviceDisplay;->paintDisplayable(IIII)V

    .line 252
    return-void
.end method

.method public setScrollDown(Z)V
    .locals 0
    .parameter "arg0"

    .prologue
    .line 257
    return-void
.end method

.method public setScrollUp(Z)V
    .locals 0
    .parameter "arg0"

    .prologue
    .line 262
    return-void
.end method
